🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / repository / src / commonMain / kotlin / org / meshtastic / core / repository / PacketHandler.kt
Displaying Raw • Download
core/repository/src/commonMain/kotlin/org/meshtastic/core/repository/PacketHandler.kt bf929c20f274232e0eb8ddc19b2dc82403e99e5b (bf929c20) Text, 2.05 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.repository
Tff7b72import T7ee787org.meshtastic.proto.MeshPacket
Tff7b72import T7ee787org.meshtastic.proto.QueueStatus
Tff7b72import T7ee787org.meshtastic.proto.ToRadio
T8b949e/** Interface for handling the transmission of packets to the radio and managing the packet queue. */
Tff7b72interface T56d364PacketHandler Tb4b4b4{
T8b949e/** Sends a command/packet directly to the radio. */
Tff7b72fun Td2a8ffsendToRadioTb4b4b4(Te6edf3pTb4b4b4: Te6edf3ToRadioTb4b4b4)
T8b949e/** Adds a mesh packet to the queue for sending. */
Tff7b72suspend Tff7b72fun Td2a8ffsendToRadioTb4b4b4(Te6edf3packetTb4b4b4: Te6edf3MeshPacketTb4b4b4)
T8b949e/**
* Adds a mesh packet to the queue and suspends until the radio acknowledges it via [QueueStatus].
*
* Unlike [sendToRadio], which is fire-and-forget, this method provides back-pressure so the caller can ensure a
* packet has been accepted by the radio before proceeding. This is critical for operations where ordering matters
* (e.g., sending a shared contact before the first DM).
*
* @return `true` if the radio accepted the packet, `false` on timeout or failure.
*/
Tff7b72suspend Tff7b72fun Td2a8ffsendToRadioAndAwaitTb4b4b4(Te6edf3packetTb4b4b4: Te6edf3MeshPacketTb4b4b4)Tb4b4b4: Tffa657Boolean
T8b949e/** Processes queue status updates from the radio. */
Tff7b72fun Td2a8ffhandleQueueStatusTb4b4b4(Te6edf3queueStatusTb4b4b4: Te6edf3QueueStatusTb4b4b4)
T8b949e/** Removes a pending response for a request. */
Tff7b72fun Td2a8ffremoveResponseTb4b4b4(Te6edf3dataRequestIdTb4b4b4: Tffa657IntTb4b4b4, Te6edf3completeTb4b4b4: Tffa657BooleanTb4b4b4)
T8b949e/** Stops the packet queue. */
Tff7b72fun Td2a8ffstopPacketQueueTb4b4b4(Tb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s